package com.github.appintro.example.ui;

import com.github.appintro.example.ui.custom.CustomBackgroundIntro;
import com.github.appintro.example.ui.custom.CustomLayoutIntro;
import com.github.appintro.example.ui.custom.SlidePolicyIntro;
import com.github.appintro.example.ui.def.DefaultIntro;
import com.github.appintro.example.ui.def.DefaultIntro2;
import com.github.appintro.example.ui.java.JavaIntro;
import com.github.appintro.example.ui.permissions.PermissionsIntro;
import com.github.appintro.example.ui.permissions.PermissionsIntro2;

import com.github.appintro.component.SkipView;
import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Button;
import ohos.agp.components.ListContainer;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class MainAbility extends Ability {
    private List<IntroEntry> listOf;
    private SkipView image;
    private Button button;

    @Override
    protected void onStart(Intent savedInstanceState) {
        super.onStart(savedInstanceState);
        init();
        testMethod();
    }

    public void init() {
        this.setUIContent(ResourceTable.Layout_activity_main);
        IntroEntry[] arrays = new IntroEntry[]{
                new IntroEntry(ResourceTable.String_default_intro_title, ResourceTable.String_default_intro, DefaultIntro.class),
                new IntroEntry(ResourceTable.String_default_intro2_title, ResourceTable.String_default_intro2, DefaultIntro2.class),
                new IntroEntry(ResourceTable.String_custom_layout_intro_title, ResourceTable.String_custom_layout_intro, CustomLayoutIntro.class),
                new IntroEntry(ResourceTable.String_custom_background_intro_title, ResourceTable.String_custom_background_intro, CustomBackgroundIntro.class),
                new IntroEntry(ResourceTable.String_slide_policy_intro_title, ResourceTable.String_slide_policy_intro, SlidePolicyIntro.class),
                new IntroEntry(ResourceTable.String_perms_intro1_title, ResourceTable.String_perms_intro1, PermissionsIntro.class),
                new IntroEntry(ResourceTable.String_perms_intro2_title, ResourceTable.String_perms_intro2, PermissionsIntro2.class),
                new IntroEntry(ResourceTable.String_default_java_intro_title, ResourceTable.String_default_java_intro, JavaIntro.class)};
        listOf = new ArrayList<>(Arrays.asList(arrays));
        ListContainer recyclerView = (ListContainer) findComponentById(ResourceTable.Id_main_recycler_view);
        IntroAdapter introAdapter = new IntroAdapter(getContext(), listOf, ResourceTable.Layout_item_intro);
        recyclerView.setItemProvider(introAdapter);
    }

    public void testMethod() {
    }
}